/ . / OpenSave
Standard open/save panels for Chimera
The classes that are designed for developer use are SaveModal, SaveModeless,
OpenModal, and OpenModeless. Initializer keywords that aren't directly
understood by these classes are passed on to the initializer of the
MillerBrowser (self.millerBrowser). See the MillerBrowser class (in
miller.py) for documentation on those keywords. The parent ,
fileEntryCommand , style , and readyCommand keywords of the
MillerBrowser should never be supplied by the developer as the open/save
classes supply these.
If the developer doesn't explicitly supply values for the addAll or
multiple keywords, then the dialog will supply a value. For open
dialogs, addAll and multiple will be true, whereas for save dialogs
they will be false.
If the developer needs to place additional widgets in the dialog, then
they should supply a clientPos keyword specifying what side of the
dialog to place the widgets (n , s , e , or w ). If clientPos
is specified, a Frame will be placed on the appropriate side of the
dialog (self.clientArea) with the grid() method and a "stickiness"
given by the clientSticky keyword (if provided). The developer
should populate the client area by overriding the fillInUI method,
calling the parent fillInUI() method and then creating widgets with
self.clientArea as a parent.
The command keyword can be used to supply a function to call when Apply ,
OK , or Close are invoked in Modeless dialogs. The two arguments
given to the function are a boolean and the dialog instance. The boolean
is 1 if Apply or OK were chosen, 0 otherwise. It is expected that if
command is supplied, then the developer will not be overriding the
Apply method.
The title keyword allows the developer to supply a title without having
to subclass. The subclassing method still works (though the keyword has
precedence if supplied). Similarly, the help keyword can provide a
help URL if something other than the generic open/save help is desired.
In open dialogs, the sample keyword (or self.sample class attribute)
allows a path to a directory containing sample data to be specified.
If sample is provided, a "Sample" button will be added to the dialog.
The "public" MillerBrowser methods are accepted by the dialog instance
directly and forwarded to self.millerBrowser. They are: setPath getPaths getPathsAndTypes getFilter setFilter addFilter
rememberDir rememberFile
[see MillerBrowser class for more info]
The most frequently used of these is getPaths /getPathsAndTypes
to find out the path name(s) chosen by the user.
These paths should be opened with this module's osOpen function, which
will handle compressed files transparently. Check the osOpen function's
doc string for details on it's use.
Functions
|
|
|
osOpen
|
osOpen (
fileName,
*args,
*kw,
)
Open a file with or without compression
Takes the same arguments as built-in open and returns a file-like
object.
If the file is opened for input, compression is checked for and
handled automatically. If the file is opened for output, the
compress keyword can be used to force or suppress compression.
If the keyword is not given, then compression will occur if the
file name ends in .gz [case independent]. If compressing,
you can supply args compatible with gzip.open().
Uncompressed non-binary files will be opened for reading with
universal newline support.
|
|
osTemporaryFile
|
osTemporaryFile ( **args )
Return a path to a file that will be deleted when Chimera exits.
|
|
osUncompressedPath
|
osUncompressedPath ( inPath )
Return a path to an uncompressed version of a file
If inPath is already uncompressed, it is simply returned.
If if is compressed, a temp uncompressed file is created and
the path to it is returned. The temp file is automatically
deleted at APPQUIT
This routine is typically used to give uncompressed file
paths to C++ functions.
|
|
|